Skip to content

IReactiveBinding interface

Defined in

Namespace: ReactiveUI Assembly: ReactiveUI.Core.dll Full name: ReactiveUI.IReactiveBinding<T1, T2> Modifiers: public abstract

Summary

        This interface represents the result of a Bind/OneWayBind and gives
        information about the binding. When this object is disposed, it will
        destroy the binding it is describing (i.e. most of the time you won't
        actually care about this object, just that it is disposable).
        

Applies to

net10.0, net10.0-maccatalyst26.0, net10.0-desktop1.0, net10.0-browserwasm1.0, net10.0-tvos26.0, net10.0-windows10.0.19041, net10.0-macos26.0, net10.0-ios26.0, net10.0-android36.0, net9.0, net9.0-tvos18.0, net9.0-macos15.0, net9.0-maccatalyst18.0, net9.0-windows10.0.19041, net9.0-ios18.0, net9.0-desktop1.0, net8.0, net8.0-windows10.0.19041, net8.0-ios18.0, net8.0-maccatalyst18.0, net8.0-macos15.0, net8.0-tvos18.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.5, netstandard2.1, net481, net462, net471

Class hierarchy
classDiagram
class IReactiveBinding~T1,T2~
class IDisposable {
    <>
}
IDisposable <|.. IReactiveBinding~T1,T2~

Implements: IDisposable

Remarks

IReactiveBinding instances are returned from helpers like Bind, OneWayBind, and BindCommand. Holding onto the binding allows you to inspect the original property expressions, observe the Changed stream, or dispose the binding manually when a different lifecycle than WhenActivated is required.

Examples

<![CDATA[
 var binding = this.Bind(ViewModel, vm => vm.UserName, v => v.UserNameTextBox.Text);
 binding.Changed.Subscribe(value => logger.LogInformation("UserName changed to {Value}", value));
 // Later
 binding.Dispose();
 ]]>

Properties

NameSummary
ViewModelExpressionGets an expression representing the property on the ViewModel bound to the view. This can be a child property, for example x.Foo.Bar.Baz in which case that will be the...
ViewGets the instance of the view this binding is applied to.
ViewExpressionGets an expression representing the property on the view bound to the ViewModel. This can be a child property, for example x.Foo.Bar.Baz in which case that will be the...
ChangedGets an observable representing changed values for the binding.
DirectionGets the direction of the binding.